package com.itheima.test2;

import com.itheima.domain.Student;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

/*
创建多个学生类对象写到文件中,再次读取到内存中
 */
public class Test01 {

    public static void main(String[] args) throws Exception {
        Student student1 = new Student("坤坤1", 26);
        Student student2 = new Student("坤坤2", 26);
        Student student3 = new Student("坤坤3", 26);
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("day13\\students.txt"));

        oos.writeObject(student1);
        oos.writeObject(student2);
        oos.writeObject(student3);

        oos.close();


    }


}
